package control.panel
{
	import global.Message;
	
	import view.panel.fast.FastReplyPanel;

	public class FastReplayPanelControl extends PanelControl
	{
		public function FastReplayPanelControl()
		{
			initPanel();
			initItems();
		}
		
		private function initPanel():void
		{
			_view.fastReplyPanel = new FastReplyPanel(this);
		}
		
		private function initItems():void
		{
			//trace(GameState.fastReplyXml.item);
			var xml:XML;
			var l:String;
			for each (xml in Message.fastReplayXml.item)
			{
				l =  xml.toString();
				_view.fastReplyPanel.addItem({label:l});
			}
		}
		
		public function open(...args):void
		{
			if (_view.fastReplyPanel.parent)
			{
				_view.fastReplyPanel.close();
			}
			else
			{
				_view.fastReplyPanel.open();
			}
		}
		
		public function onItemClick(label:String):void
		{
			_model.netRemote.sendChatMsg(label);
			_view.fastReplyPanel.close();
		}
	}
}